﻿<Page x:Class="PFC.Program.Profile.Pages.ListExpenses"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:local="clr-namespace:PFC.Program.Profile.Pages"
      mc:Ignorable="d" 
      xmlns:n="clr-namespace:PFC.CustomControls"
      d:DesignHeight="400" 
      d:DesignWidth="800"
      Title="ListExpenses">

    <Page.Resources>

        <!--Кастомный ListBox-->
        <DataTemplate x:Key="CustomListBox">
            <Grid Background="White">

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="165"/>
                    <ColumnDefinition Width="125"/>
                    <ColumnDefinition Width="280"/>
                    <ColumnDefinition Width="155"/>
                </Grid.ColumnDefinitions>

                <Label Content="{Binding Category}"
                       Grid.Column="0"
                       FontFamily="Calibri"
                       FontSize="15"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Left"
                       BorderBrush="#FFFF8000"
                       BorderThickness="1"
                       Width="145"
                       Margin="15 10 5 0">

                    <Label.Resources>
                        <Style TargetType="Border">
                            <Setter Property="CornerRadius" 
                                    Value="5 0 0 5"/>
                        </Style>
                    </Label.Resources>

                </Label>

                <Label Content="{Binding Sum}"
                       FontFamily="Calibri"
                       FontSize="15"
                       Grid.Column="1"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Left"
                       Width="120"
                       Margin="0 10 5 0"
                       BorderBrush="#FFFF8000"
                       BorderThickness="1"/>

                <Label Content="{Binding Description}"
                       Grid.Column="2"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Left"
                       Width="275"
                       FontSize="15"
                       FontFamily="Calibri"
                       Margin="0 10 5 0"
                       BorderBrush="#FFFF8000"
                       BorderThickness="1"/>

                <Label Content="{Binding Date}"
                       Grid.Column="3"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Left"
                       Width="140"
                       FontSize="15"
                       FontFamily="Calibri"
                       Margin="0 10 5 0"
                       BorderBrush="#FFFF8000"
                       BorderThickness="1">

                    <Label.Resources>
                        <Style TargetType="Border">
                            <Setter Property="CornerRadius" 
                                    Value="0 5 5 0"/>
                        </Style>
                    </Label.Resources>

                </Label>

            </Grid>
        </DataTemplate>
    </Page.Resources>


    <!--Вся остальная часть-->
    <Grid Background="#FFFF8000">

        <Grid.RowDefinitions>
            <RowDefinition Height="70"/>
            <RowDefinition Height="285"/>
        </Grid.RowDefinitions>

        <!--Верхушка-->
        <StackPanel Orientation="Horizontal"
                    VerticalAlignment="Center"
                    HorizontalAlignment="Center"
                    Height="55">
            
            <!--Возврат назад-->
            <Button Name="back_Btn"
                    Style="{DynamicResource ButtonStyle}"
                    Height="35"
                    Width="75"
                    Content="Назад"
                    FontSize="16"
                    Margin="0 15 20 0"
                    Click="back_Btn_Click"/>

            <!--Поиск-->
            <GroupBox Header="Поиск"
                      FontSize="15"
                      Style="{DynamicResource GroupBoxStyle}"
                      Foreground="White">
                <Grid>

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="150"/>
                        <ColumnDefinition Width="130"/>
                        <ColumnDefinition Width="30"/>
                    </Grid.ColumnDefinitions>

                    <TextBox Name="searchDesc_Txb"
                             Height="25"
                             Style="{DynamicResource TextBoxStyle}"
                             Width="140"
                             TextChanged="searchDesc_Txb_TextChanged">
                        
                        <TextBox.Resources>
                            <Style TargetType="Border">
                                <Setter Property="CornerRadius" Value="5"/>
                            </Style>
                        </TextBox.Resources>
                        
                    </TextBox>

                    <ComboBox Name="searchCateg_Cbx"
                              Grid.Column="1"
                              VerticalContentAlignment="Center"
                              Height="25"
                              Margin="0 0 4 0"
                              SelectionChanged="searchCateg_Cbx_SelectionChanged"/>

                    <Button Name="clean_Btn"
                            Content="X"
                            Style="{DynamicResource ButtonStyle}"
                            Padding="0"
                            Grid.Column="2"
                            Height="25"
                            Margin="2"
                            Foreground="White"
                            Click="clean_Btn_Click"/>
                    
                </Grid>
            </GroupBox>
        </StackPanel>

        <!--Список расходов-->
        <Label Content="Список всех расходов"
               Grid.Row="1"
               FontFamily="Calibri"
               FontSize="20"
               Foreground="White"
               Margin="0 5 0 0"
               VerticalAlignment="Top"
               HorizontalAlignment="Center"/>

        <ListBox Name="listExpenses_Lbx"
                 Grid.Row="1"
                 Height="235"
                 Width="756"
                 VerticalAlignment="Bottom"
                 ItemTemplate="{DynamicResource CustomListBox}"
                 d:ItemsSource="{d:SampleData ItemCount=3}"
                 Margin="10">

            <ListBox.Resources>
                <Style TargetType="Border">
                    <Setter Property="CornerRadius"
                            Value="5"/>
                </Style>
                <!--Убираем наведение на Items в ListBox-->
                <Style TargetType="{x:Type ListBoxItem}">
                    <Setter Property="Background" Value="Transparent"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                <ContentPresenter/>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </ListBox.Resources>


        </ListBox>
        
        


    </Grid>
</Page>
